<div class="form_details">
	<div class="space10"></div>
	<!--form_container starts-->
	<div class="form_container">
		<h4 style="background-color:#FF8200 !important;color:#ffffff !important;">
			<?php if(isset($form_detail[0]['event_name'])){ echo "Application for ".$form_detail[0]['event_name'].' - ';} ?>
			<?php if(isset($form_detail[0]['award_name'])){ echo $form_detail[0]['award_name'];} ?>
		</h4>
	</div>
	<!--form_container starts-->
	<div class="space10"></div>
	<!--form_container starts-->
	
	<!------------------------------------------Personal Info------------------------------->
	<?php echo form_open(BASE_URL . '/user/add_user_application', array('id' => 'user_application_form', 'method' => 'post')); ?>
	<div class="form_container">
		<h4>Personal Details</h4>
		<?php if(isset($form_list) && !empty($form_list)){
			foreach($form_list as $key => $temp)
			{
				if(isset($temp['master_application_form_subcategory']) && $temp['master_application_form_subcategory'] == 'Personal')
				{
					$personal[$key]['id']=$temp['event_application_form_id'];
					$personal[$key]['f_id']=$temp['event_application_form_field_id'];
					
					$personal[$key]['name']=$temp['master_application_form_name'];
					$personal[$key]['input_type']=$temp['master_application_form_type'];
					$personal[$key]['label']=$temp['event_application_form_label'];
					$personal[$key]['man']=$temp['event_application_form_mandatory'];
					$personal[$key]['type_extra']=$temp['master_application_form_extra'];
				}
			}
			for($i=0;$i<=ceil(count($personal)/2);$i++)
			{
				
				$n = $i*2;
				$m = $n+1;
		?>
			<!--row starts-->
			<div class="row1">
				<?php if(isset($personal[$n]['label'])){ ?>
				<div class="form-group col-sm-6">
                  <?php $data_ap = 'user_application_field'.$personal[$n]['f_id'];?>
					<label><?php echo $personal[$n]['label']; ?> <?php if($personal[$n]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
					<input type="hidden" value="<?php if($personal[$n]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $personal[$n]['name']; ?>" />
					<?php if(isset($personal[$n]['input_type'])){
						if($personal[$n]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $personal[$n]['name']; ?>" name="<?php echo $personal[$n]['name']; ?>"   autocomplete="off" type="text" 
							<?php if($personal[$n]['man'] == 'Yes') echo 'required'; ?> onblur="validateForm('<?php echo $personal[$n]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($personal[$n]['type_extra']) && $personal[$n]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $personal[$n]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
					<?php } if($personal[$n]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $personal[$n]['name']; ?>" name="<?php echo $personal[$n]['name']; ?>" onblur="validateForm('<?php echo $personal[$n]['name']; ?>');" <?php if($personal[$n]['man'] == 'Yes') echo 'required'; ?>>
								<option value="">-- Select --</option>
								<?php if($personal[$n]['label'] == 'Nationality' || $personal[$n]['label'] == 'Country of Residence'){
									if(isset($country) && !empty($country)){
										foreach($country as $temp){  ?>
											<option value='<?php echo $temp['country_id']; $line['country_id']= $temp['country_id']?>'<?php if(isset($user_data[0]->$data_ap)) { if($user_data[0]->$data_ap==$line['country_id']) { echo 'selected'; }; }?> ><?php echo $temp['country_name'];?></option>;
								<?php		}
									}	
								}
								if($personal[$n]['type_extra'] == 'gender'){
									if(isset($gender) && !empty($gender)){
										foreach($gender as $temp){
											echo '<option value="'.$temp.'">'.$temp.'</option>';
										}
									}
								}
								?>
							</select>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $personal[$n]['name']; ?>"></div>
				</div>
				<?php }
					if(isset($personal[$m]['label'])){
				?>
				<div class="form-group col-sm-6">
                 <?php $data_ap = 'user_application_field'.$personal[$m]['f_id'];?>
					<label><?php echo $personal[$m]['label']; ?> <?php if($personal[$m]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
					<input type="hidden" value="<?php if($personal[$m]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $personal[$m]['name']; ?>" />
					<?php if(isset($personal[$m]['input_type'])){ 
						if($personal[$m]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $personal[$m]['name']; ?>" name="<?php echo $personal[$m]['name']; ?>"   autocomplete="off" type="text" 
							<?php if($personal[$m]['man'] == 'Yes') echo 'required'; ?> onblur="validateForm('<?php echo $personal[$m]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($personal[$m]['type_extra']) && $personal[$m]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $personal[$m]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
						<?php } if($personal[$m]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $personal[$m]['name']; ?>" name="<?php echo $personal[$m]['name']; ?>" <?php if($personal[$m]['man'] == 'Yes') echo 'required'; ?> onblur="validateForm('<?php echo $personal[$m]['name']; ?>');">
								<option value="">-- Select --</option>
								<?php if($personal[$m]['label'] == 'Nationality' || $personal[$m]['label'] == 'Country of Residence'){
									if(isset($country) && !empty($country)){
										foreach($country as $temp){ ?>
											<option value='<?php echo $temp['country_id']; $line['country_id']= $temp['country_id']?>'<?php if(isset($user_data[0]->$data_ap)) { if($user_data[0]->$data_ap==$line['country_id']) { echo 'selected'; }; }?> ><?php echo $temp['country_name'];?></option>;
									<?php }
									}	
								}
								if($personal[$m]['type_extra'] == 'gender'){
									if(isset($gender) && !empty($gender)){
										foreach($gender as $temp){ ?>
                                        <option value="<?php echo $temp; $line1=$temp ?>"<?php if(isset($user_data[0]->$data_ap)) { if($user_data[0]->$data_ap==$line1) { echo 'selected'; }; }?>><?php echo $temp ?></option>
										<?php //	echo '<option value="'.$temp.'">'.$temp.'</option>';
										}
									}
								}
								?>
							</select>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $personal[$m]['name']; ?>"></div>
				</div>
				<?php } ?>
				<div class="clearfix"></div>
			</div>
			<!--raw closed-->
		<?php }}?>
	</div>
	<!--form_container starts-->
	<div class="space30"></div>
	<!--form_container starts-->
	
	<!------------------------------------------Contact Info------------------------------->
	
	<div class="form_container">
		<h4>Contact Details</h4>
		<!--row starts-->
		<?php if(isset($form_list) && !empty($form_list)){
			$i=0;
			foreach($form_list as $temp)
			{
				if(isset($temp['master_application_form_subcategory']) && $temp['master_application_form_subcategory'] == 'Contact')
				{
					$contact[$i]['id']=$temp['event_application_form_id'];
					$contact[$i]['f_id']=$temp['event_application_form_field_id'];
					$contact[$i]['name']=$temp['master_application_form_name'];
					$contact[$i]['input_type']=$temp['master_application_form_type'];
					$contact[$i]['label']=$temp['event_application_form_label'];
					$contact[$i]['man']=$temp['event_application_form_mandatory'];
					$contact[$i]['type_extra']=$temp['master_application_form_extra'];
					$i++;
				}
			}
			for($i=0;$i<=ceil(count($contact)/2);$i++)
			{
				$n = $i*2;
				$m = $n+1;
		?>
			<!--row starts-->
			<div class="row1">
				<?php if(isset($contact[$n]['label'])){ ?>
				<div class="form-group col-sm-6" <?php if($contact[$n]['input_type'] == 'textarea'){ echo "style='width:100% !important;'";} ?>>
                 <?php $data_ap = 'user_application_field'.$contact[$n]['f_id'];?>
					<label><?php echo $contact[$n]['label']; ?> <?php if($contact[$n]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
					<input type="hidden" value="<?php if($contact[$n]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $contact[$n]['name']; ?>" />
					<?php if(isset($contact[$n]['input_type'])){
						if($contact[$n]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $contact[$n]['name']; ?>" name="<?php echo $contact[$n]['name']; ?>"   autocomplete="off" type="text" 
							<?php if($contact[$n]['man'] == 'Yes') echo 'required'; ?>  onblur="validateForm('<?php echo $contact[$n]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($contact[$n]['type_extra']) && $contact[$n]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $contact[$n]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
					<?php } else if($contact[$n]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $contact[$n]['name']; ?>" name="<?php echo $contact[$n]['name']; ?>" <?php if($contact[$n]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $contact[$n]['name']; ?>');">
								<option value="">-- Select --</option>
								<?php if($contact[$n]['label'] == 'Country'){
									if(isset($country) && !empty($country)){
										foreach($country as $temp){?>
											<option value='<?php echo $temp['country_id']; $line['country_id']= $temp['country_id']?>'<?php if(isset($user_data[0]->$data_ap)) { if($user_data[0]->$data_ap==$line['country_id']) { echo 'selected'; }; }?> ><?php echo $temp['country_name'];?></option>;
									<?php }
									}	
								}?>
							</select>
					<?php } else if($contact[$n]['input_type'] == 'textarea'){?>
							<textarea class="form-control white" id="<?php echo $contact[$n]['name']; ?>" name="<?php echo $contact[$n]['name']; ?>" <?php if($contact[$n]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $contact[$n]['name']; ?>');"><?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?></textarea>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $contact[$n]['name']; ?>"></div>
				</div>
				<?php if($contact[$n]['input_type'] == 'textarea' || (isset($contact[$m]['input_type']) && $contact[$m]['input_type'] == 'textarea')){?>
						<div class="clearfix"></div>
				<?php }}
					if(isset($contact[$m]['label'])){
				?>
				<div class="form-group col-sm-6" <?php if($contact[$m]['input_type'] == 'textarea'){ echo "style='width:100% !important;'";} ?>>
					<label><?php echo $contact[$m]['label']; ?> <?php if($contact[$m]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
                    <?php $data_ap = 'user_application_field'.$contact[$m]['f_id'];?>
					<input type="hidden" value="<?php if($contact[$m]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $contact[$m]['name']; ?>" />
					<?php if(isset($contact[$m]['input_type'])){
						if($contact[$m]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $contact[$m]['name']; ?>" name="<?php echo $contact[$m]['name']; ?>"   autocomplete="off" type="text" 
							<?php if($contact[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $contact[$m]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($contact[$m]['type_extra']) && $contact[$m]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $contact[$m]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
						<?php } if($contact[$m]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $contact[$m]['name']; ?>" name="<?php echo $contact[$m]['name']; ?>" <?php if($contact[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $contact[$m]['name']; ?>');">
								<option value="">-- Select --</option>
								<?php if($contact[$m]['label'] == 'Country'){
									if(isset($country) && !empty($country)){
										foreach($country as $temp){?>
											<option value='<?php echo $temp['country_id']; $line['country_id']= $temp['country_id']?>'<?php if(isset($user_data[0]->$data_ap)) { if($user_data[0]->$data_ap==$line['country_id']) { echo 'selected'; }; }?> ><?php echo $temp['country_name'];?></option>;
									<?php }
									}	
								}?>
							</select>
						<?php } if($contact[$m]['input_type'] == 'textarea'){?>
							<textarea class="form-control white" id="<?php echo $contact[$m]['name']; ?>" name="<?php echo $contact[$m]['name']; ?>" <?php if($contact[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $contact[$m]['name']; ?>');"><?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?></textarea>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $contact[$m]['name']; ?>"></div>
				</div>
				<?php } ?>
				<div class="clearfix"></div>
			</div>
			<!--raw closed-->
		<?php }}?>
		<!--raw closed-->
	</div>
	<!--form_container starts-->
	<div class="space30"></div>
	<!--form_container starts-->
	
	<!------------------------------------------Extra Info------------------------------->
	<?php if(isset($form_list) && !empty($form_list)){ 
		$i=0;
			foreach($form_list as $temp)
			{
				if(isset($temp['master_application_form_subcategory']) && $temp['master_application_form_subcategory'] == 'Extra')
				{
					$extra[$i]['id']=$temp['event_application_form_id'];
					$extra[$i]['f_id']=$temp['event_application_form_field_id'];
					$extra[$i]['name']=$temp['master_application_form_name'];
					$extra[$i]['input_type']=$temp['master_application_form_type'];
					$extra[$i]['label']=$temp['event_application_form_label'];
					$extra[$i]['man']=$temp['event_application_form_mandatory'];
					$extra[$i]['type_extra']=$temp['master_application_form_extra'];
					$i++;
				}
			}
	?>
	<div class="form_container">
		<h4>Other Details</h4>
		<!--row starts-->
		<?php
			for($i=0;$i<=ceil(count($extra)/2);$i++)
			{
				$n = $i*2;
				$m = $n+1;
		?>
			<!--row starts-->
			<div class="row1">
				<?php if(isset($extra[$n]['label'])){ ?>
				<div class="form-group col-sm-6" <?php if($extra[$n]['input_type'] == 'textarea'){ echo "style='width:100% !important;'";} ?>>
                 <?php $data_ap = 'user_application_field'.$extra[$n]['f_id'];?>
					<label><?php echo $extra[$n]['label']; ?> <?php if($extra[$n]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
					<input type="hidden" value="<?php if($extra[$n]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $extra[$n]['name']; ?>" />
					<?php if(isset($extra[$n]['input_type'])){
						if($extra[$n]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $extra[$n]['name']; ?>" name="<?php echo $extra[$n]['name']; ?>" autocomplete="off"  autocomplete="off" type="text" 
							<?php if($extra[$n]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$n]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($extra[$n]['type_extra']) && $extra[$n]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $extra[$n]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
					<?php } else if($extra[$n]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $extra[$n]['name']; ?>" name="<?php echo $extra[$n]['name']; ?>" <?php if($extra[$n]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$n]['name']; ?>');">
								<option value="">-- Select --</option>
							</select>
					<?php } else if($extra[$n]['input_type'] == 'textarea'){?>
							<textarea class="form-control white" id="<?php echo $extra[$n]['name']; ?>" name="<?php echo $extra[$n]['name']; ?>" <?php if($extra[$n]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$n]['name']; ?>');"><?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?></textarea>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $extra[$n]['name']; ?>"></div>
				</div>
				<?php if($extra[$n]['input_type'] == 'textarea' || (isset($extra[$m]['input_type']) && $extra[$m]['input_type'] == 'textarea')){?>
						<div class="clearfix"></div>
				<?php }}
					if(isset($extra[$m]['label'])){
				?>
				<div class="form-group col-sm-6" <?php if($extra[$m]['input_type'] == 'textarea'){ echo "style='width:100% !important;'";} ?>>
                <?php $data_ap = 'user_application_field'.$extra[$m]['f_id'];?>
					<label><?php echo $extra[$m]['label']; ?> <?php if($extra[$m]['man'] == 'Yes') echo "<span class='asterisk'>*</span>"; ?></label>
					<input type="hidden" value="<?php if($extra[$m]['man'] == 'Yes') echo "1"; else echo '0'; ?>" id="man-<?php echo $extra[$m]['name']; ?>" />
					<?php if(isset($extra[$m]['input_type'])){
						if($extra[$m]['input_type'] == 'input'){?>
							<input class="form-control white" id="<?php echo $extra[$m]['name']; ?>" name="<?php echo $extra[$m]['name']; ?>"   autocomplete="off" type="text" 
							<?php if($extra[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$m]['name']; ?>');" value="<?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?>">
							<?php if(isset($extra[$m]['type_extra']) && $extra[$m]['type_extra'] == 'datepicker'){ ?>
								<script type="text/javascript">
									window.onload = function(){
										new JsDatePick({
											useMode:2,
											target:"<?php echo $extra[$m]['name']; ?>",
											dateFormat:"%d-%M-%Y",
											yearsRange:[1955,2050],
											imgPath:"<?php echo ASSET_URL; ?>img/"
										});
									};
								</script>
							<?php }?>
						<?php } if($extra[$m]['input_type'] == 'dropdown'){?>
							<select class="form-control white" id="<?php echo $extra[$m]['name']; ?>" name="<?php echo $extra[$m]['name']; ?>" <?php if($extra[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$m]['name']; ?>');">
								<option></option>
							</select>
						<?php } if($extra[$m]['input_type'] == 'textarea'){?>
							<textarea class="form-control white" id="<?php echo $extra[$m]['name']; ?>" name="<?php echo $extra[$m]['name']; ?>" <?php if($extra[$m]['man'] == 'Yes') echo 'required'; ?>   onblur="validateForm('<?php echo $extra[$m]['name']; ?>');"><?php if(isset($user_data[0]->$data_ap)) { echo $user_data[0]->$data_ap; }?></textarea>
					<?php }}?>
					<div class="error error_msg" id="err-<?php echo $extra[$m]['name']; ?>"></div>
				</div>
				<?php } ?>
				<div class="clearfix"></div>
			</div>
			<!--raw closed-->
		<?php }?>
		<!--raw closed-->
	</div>
	<?php }?>
	<!--form_container starts-->
	<div class="space30"></div>
	<input type="hidden" name="app_award_id" value="<?php if(isset($form_detail[0]['award_id'])){ echo $form_detail[0]['award_id'];} ?>" />
	<input type="hidden" name="app_type" value="personal" />
	<input type="hidden" name="app_applicant_id" value="<?php echo $this->session->userdata('user_id'); ?>" />
	<input type="hidden" name="app_submit" id="app_submit" value="<?php if(isset($form_submit) && !empty($form_submit)) echo '1';else echo '0'; ?>" />
	<button type="button" class="btn btn-primary" id="applicant_form_submit_personal">
		Save & Continue
	</button>
	<?php echo form_close(); ?>
</div>